/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fiap.controler;

import br.com.fiap.modelos.DadosForm;
import br.com.fiap.modelos.DadosSac;
import br.com.fiap.persistencia.DAOWeb;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Jose Arce - rm64586
 */

@WebServlet(urlPatterns="/processarPesquisaReclamacao")
public class ProcessarReclamacoes extends HttpServlet{
    
    private String dtInicial;
    
    private String dtFinal;
    
    private DAOWeb persiste;
    
    
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        
        dtInicial = req.getParameter("dtInicial");
        
        dtFinal = req.getParameter("dtFinal");
        
        persiste = new DAOWeb();
        
       List<DadosForm> reclamacoes = persiste.pesquisarPorData(dtInicial,dtFinal);
        
        req.setAttribute("modelo", reclamacoes);
        
        //delegar o processamento para VIEW
        req.getRequestDispatcher("/relatorioReclamacoes").forward(req, resp);
        
     
    }
    
}
